package oj.day43;

import java.util.Arrays;
import java.util.Scanner;

public class ruby和薯条 {
    //自己的做法暴力枚举,40%
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(),l = in.nextInt(),r = in.nextInt();
        int[] a = new int[n];
        for(int i = 0;i < n;i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int ret = 0;
        for(int left = 0;left < n;left++) {
            for(int right = left+1;right < n;right++) {
                if(a[right]-a[left] < l) {
                    continue;
                }
                if(a[right]-a[left] > r) {
                    break;
                }
                ret++;
            }
        }
        System.out.println(ret);
    }
    //正确解法,排序+二分
    public void teacher() {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(),l = in.nextInt(),r = in.nextInt();
        int[] a = new int[n];
        for(int i = 0;i < n;i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        long ret = 0,s = 0,e = 0;
        for(int i = 0;l+a[i] <= a[n-1] && i < n;i++) {
            int left = 0,right = n-1,mid = 0;
            while(left < right) {
                mid = (left+right)/2;
                if(a[mid] < l+a[i]) {
                    left = mid+1;
                }else {
                    right = mid;
                }
            }
            s = (long)left;
            left = 0;right = n-1;mid = 0;
            while(left < right) {
                mid = (left+right)/2+1;
                if(a[mid] <= r+a[i]) {
                    left = mid;
                }else {
                    right = mid-1;
                }
            }
            e = (long)left;
            ret += (e-s+1);
        }
        System.out.println(ret);
    }
}
